package com.hfjava.question.dto;

/**
 *
 * 统一返回工具类
 */
public class RUtils {


    /***
     * 成功 带数据  查询操作
     * @return
     */
    public static R returnSuccess(Object data){
        R returnResult=new R();
        returnResult.setCode(200);
        returnResult.setMessage("success");
        returnResult.setData(data);
        return returnResult;
    }
    /***
     * 失败
     * @return
     */
    public static R returnFail(Integer code, String message){
        R returnResult=new R();
        returnResult.setCode(code);
        returnResult.setMessage(message);
        return returnResult;
    }

    /***
     * 成功 不带数据 增、删、改操作
     * @return
     */
    public static R returnSuccess(Integer code, String message){
        R returnResult=new R();
        returnResult.setCode(code);
        returnResult.setMessage(message);
        return returnResult;
    }
}
